3.254 \(\int \frac {1}{a+b \tan ^2(c+d x)} \, dx\)

Optimal. Leaf size=50 \[ \frac {x}{a-b}-\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a} d (a-b)} \]

[Out]

x/(a-b)-arctan(b^(1/2)*tan(d*x+c)/a^(1/2))*b^(1/2)/(a-b)/d/a^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.07, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3660, 3675, 205} \[ \frac {x}{a-b}-\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a} d (a-b)} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[c + d*x]^2)^(-1),x]

[Out]

x/(a - b) - (Sqrt[b]*ArcTan[(Sqrt[b]*Tan[c + d*x])/Sqrt[a]])/(Sqrt[a]*(a - b)*d)

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 3660

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(-1), x_Symbol] :> Simp[x/(a - b), x] - Dist[b/(a - b), Int[Sec[e
 + f*x]^2/(a + b*Tan[e + f*x]^2), x], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a, b]

Rule 3675

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/(c^(m - 1)*f), Subst[Int[(c^2 + ff^2*x^2)^(m/2 - 1)*(a + b*(ff*x)
^n)^p, x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2] && (IntegersQ[n, p
] || IGtQ[m, 0] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps

\begin {align*} \int \frac {1}{a+b \tan ^2(c+d x)} \, dx &=\frac {x}{a-b}-\frac {b \int \frac {\sec ^2(c+d x)}{a+b \tan ^2(c+d x)} \, dx}{a-b}\\ &=\frac {x}{a-b}-\frac {b \operatorname {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\tan (c+d x)\right )}{(a-b) d}\\ &=\frac {x}{a-b}-\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a} (a-b) d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.08, size = 49, normalized size = 0.98 \[ \frac {\tan ^{-1}(\tan (c+d x))-\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a}}}{a d-b d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[c + d*x]^2)^(-1),x]

[Out]

(ArcTan[Tan[c + d*x]] - (Sqrt[b]*ArcTan[(Sqrt[b]*Tan[c + d*x])/Sqrt[a]])/Sqrt[a])/(a*d - b*d)

________________________________________________________________________________________

fricas [A]  time = 0.48, size = 182, normalized size = 3.64 \[ \left [\frac {4 \, d x - \sqrt {-\frac {b}{a}} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{4} - 6 \, a b \tan \left (d x + c\right )^{2} + a^{2} + 4 \, {\left (a b \tan \left (d x + c\right )^{3} - a^{2} \tan \left (d x + c\right )\right )} \sqrt {-\frac {b}{a}}}{b^{2} \tan \left (d x + c\right )^{4} + 2 \, a b \tan \left (d x + c\right )^{2} + a^{2}}\right )}{4 \, {\left (a - b\right )} d}, \frac {2 \, d x - \sqrt {\frac {b}{a}} \arctan \left (\frac {{\left (b \tan \left (d x + c\right )^{2} - a\right )} \sqrt {\frac {b}{a}}}{2 \, b \tan \left (d x + c\right )}\right )}{2 \, {\left (a - b\right )} d}\right ] \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

[1/4*(4*d*x - sqrt(-b/a)*log((b^2*tan(d*x + c)^4 - 6*a*b*tan(d*x + c)^2 + a^2 + 4*(a*b*tan(d*x + c)^3 - a^2*ta
n(d*x + c))*sqrt(-b/a))/(b^2*tan(d*x + c)^4 + 2*a*b*tan(d*x + c)^2 + a^2)))/((a - b)*d), 1/2*(2*d*x - sqrt(b/a
)*arctan(1/2*(b*tan(d*x + c)^2 - a)*sqrt(b/a)/(b*tan(d*x + c))))/((a - b)*d)]

________________________________________________________________________________________

giac [A]  time = 0.82, size = 65, normalized size = 1.30 \[ -\frac {\frac {{\left (\pi \left \lfloor \frac {d x + c}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (b) + \arctan \left (\frac {b \tan \left (d x + c\right )}{\sqrt {a b}}\right )\right )} b}{\sqrt {a b} {\left (a - b\right )}} - \frac {d x + c}{a - b}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*tan(d*x+c)^2),x, algorithm="giac")

[Out]

-((pi*floor((d*x + c)/pi + 1/2)*sgn(b) + arctan(b*tan(d*x + c)/sqrt(a*b)))*b/(sqrt(a*b)*(a - b)) - (d*x + c)/(
a - b))/d

________________________________________________________________________________________

maple [A]  time = 0.20, size = 52, normalized size = 1.04 \[ -\frac {b \arctan \left (\frac {\tan \left (d x +c \right ) b}{\sqrt {a b}}\right )}{d \left (a -b \right ) \sqrt {a b}}+\frac {\arctan \left (\tan \left (d x +c \right )\right )}{d \left (a -b \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(a+b*tan(d*x+c)^2),x)

[Out]

-1/d*b/(a-b)/(a*b)^(1/2)*arctan(tan(d*x+c)*b/(a*b)^(1/2))+1/d/(a-b)*arctan(tan(d*x+c))

________________________________________________________________________________________

maxima [A]  time = 0.78, size = 48, normalized size = 0.96 \[ -\frac {\frac {b \arctan \left (\frac {b \tan \left (d x + c\right )}{\sqrt {a b}}\right )}{\sqrt {a b} {\left (a - b\right )}} - \frac {d x + c}{a - b}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

-(b*arctan(b*tan(d*x + c)/sqrt(a*b))/(sqrt(a*b)*(a - b)) - (d*x + c)/(a - b))/d

________________________________________________________________________________________

mupad [B]  time = 11.90, size = 948, normalized size = 18.96 \[ -\frac {\mathrm {atan}\left (\frac {\frac {-4\,b^3\,\mathrm {tan}\left (c+d\,x\right )+\frac {\left (4\,b^4-8\,a\,b^3+4\,a^2\,b^2+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}}{2\,a-2\,b}+\frac {-4\,b^3\,\mathrm {tan}\left (c+d\,x\right )+\frac {\left (8\,a\,b^3-4\,b^4-4\,a^2\,b^2+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}}{2\,a-2\,b}}{\frac {\left (-4\,b^3\,\mathrm {tan}\left (c+d\,x\right )+\frac {\left (4\,b^4-8\,a\,b^3+4\,a^2\,b^2+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}-\frac {\left (-4\,b^3\,\mathrm {tan}\left (c+d\,x\right )+\frac {\left (8\,a\,b^3-4\,b^4-4\,a^2\,b^2+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}}\right )}{d\,\left (a-b\right )}+\frac {\mathrm {atan}\left (\frac {\frac {\sqrt {-a\,b}\,\left (2\,b^3\,\mathrm {tan}\left (c+d\,x\right )-\frac {\sqrt {-a\,b}\,\left (2\,b^4-4\,a\,b^3+2\,a^2\,b^2+\frac {\mathrm {tan}\left (c+d\,x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )}{4\,\left (a\,b-a^2\right )}\right )}{2\,\left (a\,b-a^2\right )}\right )\,1{}\mathrm {i}}{a\,b-a^2}+\frac {\sqrt {-a\,b}\,\left (2\,b^3\,\mathrm {tan}\left (c+d\,x\right )-\frac {\sqrt {-a\,b}\,\left (4\,a\,b^3-2\,b^4-2\,a^2\,b^2+\frac {\mathrm {tan}\left (c+d\,x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )}{4\,\left (a\,b-a^2\right )}\right )}{2\,\left (a\,b-a^2\right )}\right )\,1{}\mathrm {i}}{a\,b-a^2}}{\frac {\sqrt {-a\,b}\,\left (2\,b^3\,\mathrm {tan}\left (c+d\,x\right )-\frac {\sqrt {-a\,b}\,\left (2\,b^4-4\,a\,b^3+2\,a^2\,b^2+\frac {\mathrm {tan}\left (c+d\,x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )}{4\,\left (a\,b-a^2\right )}\right )}{2\,\left (a\,b-a^2\right )}\right )}{a\,b-a^2}-\frac {\sqrt {-a\,b}\,\left (2\,b^3\,\mathrm {tan}\left (c+d\,x\right )-\frac {\sqrt {-a\,b}\,\left (4\,a\,b^3-2\,b^4-2\,a^2\,b^2+\frac {\mathrm {tan}\left (c+d\,x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )}{4\,\left (a\,b-a^2\right )}\right )}{2\,\left (a\,b-a^2\right )}\right )}{a\,b-a^2}}\right )\,\sqrt {-a\,b}\,1{}\mathrm {i}}{a\,d\,\left (a-b\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(a + b*tan(c + d*x)^2),x)

[Out]

(atan((((-a*b)^(1/2)*(2*b^3*tan(c + d*x) - ((-a*b)^(1/2)*(2*b^4 - 4*a*b^3 + 2*a^2*b^2 + (tan(c + d*x)*(-a*b)^(
1/2)*(8*a*b^4 - 8*b^5 + 8*a^2*b^3 - 8*a^3*b^2))/(4*(a*b - a^2))))/(2*(a*b - a^2)))*1i)/(a*b - a^2) + ((-a*b)^(
1/2)*(2*b^3*tan(c + d*x) - ((-a*b)^(1/2)*(4*a*b^3 - 2*b^4 - 2*a^2*b^2 + (tan(c + d*x)*(-a*b)^(1/2)*(8*a*b^4 -
8*b^5 + 8*a^2*b^3 - 8*a^3*b^2))/(4*(a*b - a^2))))/(2*(a*b - a^2)))*1i)/(a*b - a^2))/(((-a*b)^(1/2)*(2*b^3*tan(
c + d*x) - ((-a*b)^(1/2)*(2*b^4 - 4*a*b^3 + 2*a^2*b^2 + (tan(c + d*x)*(-a*b)^(1/2)*(8*a*b^4 - 8*b^5 + 8*a^2*b^
3 - 8*a^3*b^2))/(4*(a*b - a^2))))/(2*(a*b - a^2))))/(a*b - a^2) - ((-a*b)^(1/2)*(2*b^3*tan(c + d*x) - ((-a*b)^
(1/2)*(4*a*b^3 - 2*b^4 - 2*a^2*b^2 + (tan(c + d*x)*(-a*b)^(1/2)*(8*a*b^4 - 8*b^5 + 8*a^2*b^3 - 8*a^3*b^2))/(4*
(a*b - a^2))))/(2*(a*b - a^2))))/(a*b - a^2)))*(-a*b)^(1/2)*1i)/(a*d*(a - b)) - atan(((((4*b^4 - 8*a*b^3 + 4*a
^2*b^2 + (tan(c + d*x)*(8*a*b^4 - 8*b^5 + 8*a^2*b^3 - 8*a^3*b^2)*1i)/(2*a - 2*b))*1i)/(2*a - 2*b) - 4*b^3*tan(
c + d*x))/(2*a - 2*b) + (((8*a*b^3 - 4*b^4 - 4*a^2*b^2 + (tan(c + d*x)*(8*a*b^4 - 8*b^5 + 8*a^2*b^3 - 8*a^3*b^
2)*1i)/(2*a - 2*b))*1i)/(2*a - 2*b) - 4*b^3*tan(c + d*x))/(2*a - 2*b))/(((((4*b^4 - 8*a*b^3 + 4*a^2*b^2 + (tan
(c + d*x)*(8*a*b^4 - 8*b^5 + 8*a^2*b^3 - 8*a^3*b^2)*1i)/(2*a - 2*b))*1i)/(2*a - 2*b) - 4*b^3*tan(c + d*x))*1i)
/(2*a - 2*b) - ((((8*a*b^3 - 4*b^4 - 4*a^2*b^2 + (tan(c + d*x)*(8*a*b^4 - 8*b^5 + 8*a^2*b^3 - 8*a^3*b^2)*1i)/(
2*a - 2*b))*1i)/(2*a - 2*b) - 4*b^3*tan(c + d*x))*1i)/(2*a - 2*b)))/(d*(a - b))

________________________________________________________________________________________

sympy [A]  time = 2.40, size = 280, normalized size = 5.60 \[ \begin {cases} \frac {\tilde {\infty } x}{\tan ^{2}{\relax (c )}} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {x}{a} & \text {for}\: b = 0 \\\frac {- x - \frac {1}{d \tan {\left (c + d x \right )}}}{b} & \text {for}\: a = 0 \\\frac {d x \tan ^{2}{\left (c + d x \right )}}{2 b d \tan ^{2}{\left (c + d x \right )} + 2 b d} + \frac {d x}{2 b d \tan ^{2}{\left (c + d x \right )} + 2 b d} + \frac {\tan {\left (c + d x \right )}}{2 b d \tan ^{2}{\left (c + d x \right )} + 2 b d} & \text {for}\: a = b \\\frac {x}{a + b \tan ^{2}{\relax (c )}} & \text {for}\: d = 0 \\\frac {2 i \sqrt {a} d x \sqrt {\frac {1}{b}}}{2 i a^{\frac {3}{2}} d \sqrt {\frac {1}{b}} - 2 i \sqrt {a} b d \sqrt {\frac {1}{b}}} - \frac {\log {\left (- i \sqrt {a} \sqrt {\frac {1}{b}} + \tan {\left (c + d x \right )} \right )}}{2 i a^{\frac {3}{2}} d \sqrt {\frac {1}{b}} - 2 i \sqrt {a} b d \sqrt {\frac {1}{b}}} + \frac {\log {\left (i \sqrt {a} \sqrt {\frac {1}{b}} + \tan {\left (c + d x \right )} \right )}}{2 i a^{\frac {3}{2}} d \sqrt {\frac {1}{b}} - 2 i \sqrt {a} b d \sqrt {\frac {1}{b}}} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*tan(d*x+c)**2),x)

[Out]

Piecewise((zoo*x/tan(c)**2, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), (x/a, Eq(b, 0)), ((-x - 1/(d*tan(c + d*x)))/b, Eq
(a, 0)), (d*x*tan(c + d*x)**2/(2*b*d*tan(c + d*x)**2 + 2*b*d) + d*x/(2*b*d*tan(c + d*x)**2 + 2*b*d) + tan(c +
d*x)/(2*b*d*tan(c + d*x)**2 + 2*b*d), Eq(a, b)), (x/(a + b*tan(c)**2), Eq(d, 0)), (2*I*sqrt(a)*d*x*sqrt(1/b)/(
2*I*a**(3/2)*d*sqrt(1/b) - 2*I*sqrt(a)*b*d*sqrt(1/b)) - log(-I*sqrt(a)*sqrt(1/b) + tan(c + d*x))/(2*I*a**(3/2)
*d*sqrt(1/b) - 2*I*sqrt(a)*b*d*sqrt(1/b)) + log(I*sqrt(a)*sqrt(1/b) + tan(c + d*x))/(2*I*a**(3/2)*d*sqrt(1/b)
- 2*I*sqrt(a)*b*d*sqrt(1/b)), True))

________________________________________________________________________________________